<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RabbitMQ Channel 机制详解 | 技术小馆</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background-color: #f8f9fa;
            color: #333;
            line-height: 1.6;
        }
        .serif {
            font-family: 'Noto Serif SC', serif;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        }
        .highlight-box {
            border-left: 4px solid #667eea;
            background-color: rgba(102, 126, 234, 0.05);
        }
        .drop-capital::first-letter {
            float: left;
            font-size: 4.5rem;
            line-height: 0.65;
            margin: 0.1em 0.2em 0 0;
            color: #667eea;
            font-weight: bold;
        }
        .nav-link {
            position: relative;
        }
        .nav-link::after {
            content: '';
            position: absolute;
            width: 0;
            height: 2px;
            bottom: -2px;
            left: 0;
            background-color: #667eea;
            transition: width 0.3s ease;
        }
        .nav-link:hover::after {
            width: 100%;
        }
        .code-block {
            background-color: #2d2d2d;
            color: #f8f8f2;
            border-radius: 6px;
            overflow: hidden;
        }
        .btn-primary {
            background-color: #667eea;
            transition: all 0.3s ease;
        }
        .btn-primary:hover {
            background-color: #5a6fd1;
            transform: translateY(-2px);
        }
    </style>
</head>
<body class="antialiased">
    <!-- Navigation -->
    <nav class="bg-white shadow-sm py-4 sticky top-0 z-50">
        <div class="container mx-auto px-6 flex justify-between items-center">
            <div class="text-xl font-bold text-gray-800">
                <i class="fas fa-code text-indigo-600 mr-2"></i>
                <span class="serif">技术小馆</span>
            </div>
            <div class="hidden md:flex space-x-8">
                <a href="#" class="text-gray-600 hover:text-indigo-600 nav-link">首页</a>
                <a href="#" class="text-gray-600 hover:text-indigo-600 nav-link">RabbitMQ</a>
                <a href="#" class="text-gray-600 hover:text-indigo-600 nav-link">教程</a>
                <a href="#" class="text-gray-600 hover:text-indigo-600 nav-link">关于</a>
            </div>
            <button class="md:hidden text-gray-600">
                <i class="fas fa-bars text-xl"></i>
            </button>
        </div>
    </nav>

    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20">
        <div class="container mx-auto px-6 flex flex-col items-center">
            <div class="w-full md:w-3/4 lg:w-2/3 text-center">
                <h1 class="text-4xl md:text-5xl font-bold mb-6 serif">RabbitMQ Channel 机制解析</h1>
                <p class="text-xl md:text-2xl mb-8 opacity-90 leading-relaxed">探索轻量级逻辑通道在消息队列中的核心作用与最佳实践</p>
                <div class="flex justify-center space-x-4">
                    <a href="#content" class="px-6 py-3 bg-white text-indigo-600 font-medium rounded-lg shadow-md hover:bg-gray-100 transition duration-300 flex items-center">
                        <i class="fas fa-book-reader mr-2"></i> 开始阅读
                    </a>
                    <a href="#" class="px-6 py-3 bg-indigo-800 text-white font-medium rounded-lg shadow-md hover:bg-indigo-900 transition duration-300 flex items-center">
                        <i class="fas fa-code mr-2"></i> 查看代码
                    </a>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto px-6 py-12">
        <div class="flex flex-col lg:flex-row gap-12">
            <!-- Article Content -->
            <article class="w-full lg:w-2/3">
                <!-- Meta Info -->
                <div class="flex items-center text-gray-500 mb-8">
                    <div class="flex items-center mr-6">
                        <i class="far fa-calendar-alt mr-2"></i>
                        <span>2023年11月15日</span>
                    </div>
                    <div class="flex items-center mr-6">
                        <i class="far fa-clock mr-2"></i>
                        <span>10分钟阅读</span>
                    </div>
                    <div class="flex items-center">
                        <i class="far fa-eye mr-2"></i>
                        <span>2.4k浏览</span>
                    </div>
                </div>

                <!-- Introduction -->
                <section class="mb-12">
                    <p class="text-xl leading-relaxed mb-6 drop-capital">在 RabbitMQ 中，`Channel` 是一种重要的机制，用于处理消息的发布、消费、队列管理等操作。它可以被认为是连接（Connection）内的一个逻辑通道，提供了一种轻量级的方式来进行消息操作。</p>
                    
                    <div class="bg-blue-50 p-6 rounded-lg border border-blue-100 mb-6">
                        <div class="flex items-start">
                            <div class="flex-shrink-0 text-blue-500 text-xl mr-4 mt-1">
                                <i class="fas fa-lightbulb"></i>
                            </div>
                            <div>
                                <h3 class="text-lg font-semibold text-blue-800 mb-2">关键要点</h3>
                                <ul class="list-disc pl-5 text-blue-700 space-y-1">
                                    <li>Channel 是连接内的轻量级逻辑通道</li>
                                    <li>一个连接可以创建多个 Channel 提高效率</li>
                                    <li>负责消息发布、消费和队列管理等核心操作</li>
                                    <li>支持事务和确认机制保证可靠性</li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </section>

                <!-- Section 1 -->
                <section class="mb-12">
                    <h2 class="text-2xl md:text-3xl font-bold mb-6 text-gray-800 serif border-b pb-2">1. Channel 的基本概念</h2>
                    
                    <div class="grid md:grid-cols-2 gap-6 mb-6">
                        <div class="bg-white p-6 rounded-lg shadow-sm border border-gray-100 card-hover">
                            <div class="text-indigo-500 text-3xl mb-4">
                                <i class="fas fa-project-diagram"></i>
                            </div>
                            <h3 class="text-xl font-semibold mb-3 text-gray-800">逻辑通道</h3>
                            <p class="text-gray-600">`Channel` 是在 RabbitMQ 的连接（`Connection`）内创建的多个逻辑通道之一。一个连接可以同时有多个 `Channel`，每个 `Channel` 负责处理不同的消息流和操作。</p>
                        </div>
                        
                        <div class="bg-white p-6 rounded-lg shadow-sm border border-gray-100 card-hover">
                            <div class="text-indigo-500 text-3xl mb-4">
                                <i class="fas fa-feather-alt"></i>
                            </div>
                            <h3 class="text-xl font-semibold mb-3 text-gray-800">轻量级</h3>
                            <p class="text-gray-600">相比于连接（`Connection`），`Channel` 是轻量级的。创建和使用 `Channel` 的开销较小，通常比创建多个连接更高效。RabbitMQ 推荐在一个连接上创建多个 `Channel` 以提高资源利用率。</p>
                        </div>
                    </div>
                    
                    <!-- Mermaid Diagram -->
                    <div class="bg-white p-6 rounded-lg shadow-sm border border-gray-100 mb-6">
                        <h3 class="text-lg font-semibold mb-4 text-gray-800 flex items-center">
                            <i class="fas fa-diagram-project text-indigo-500 mr-2"></i>
                            Connection 与 Channel 关系图
                        </h3>
                        <div class="mermaid">
                            graph TD
                                A[应用程序] --> B[Connection]
                                B --> C[Channel 1]
                                B --> D[Channel 2]
                                B --> E[Channel 3]
                                C --> F[队列1]
                                D --> G[队列2]
                                E --> H[队列3]
                        </div>
                    </div>
                </section>

                <!-- Section 2 -->
                <section class="mb-12">
                    <h2 class="text-2xl md:text-3xl font-bold mb-6 text-gray-800 serif border-b pb-2">2. Channel 的作用</h2>
                    
                    <div class="mb-8">
                        <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                            <i class="fas fa-exchange-alt text-indigo-500 mr-2"></i>
                            消息发布与消费
                        </h3>
                        <div class="grid md:grid-cols-2 gap-6">
                            <div class="highlight-box p-6 rounded">
                                <h4 class="font-bold text-lg mb-2 text-indigo-600">消息发布</h4>
                                <p class="text-gray-700">生产者使用 `Channel` 发布消息到交换机。`Channel` 提供了方法来指定交换机、路由键以及消息属性，从而将消息发送到目标队列。</p>
                            </div>
                            <div class="highlight-box p-6 rounded">
                                <h4 class="font-bold text-lg mb-2 text-indigo-600">消息消费</h4>
                                <p class="text-gray-700">消费者通过 `Channel` 从队列中接收消息。`Channel` 提供了方法来注册消费者、处理消息、确认消息等。</p>
                            </div>
                        </div>
                    </div>
                    
                    <div class="mb-8">
                        <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                            <i class="fas fa-layer-group text-indigo-500 mr-2"></i>
                            队列管理
                        </h3>
                        <div class="grid md:grid-cols-2 gap-6">
                            <div class="bg-white p-4 rounded-lg shadow-sm border border-gray-100">
                                <h4 class="font-bold mb-2 text-gray-800">队列声明</h4>
                                <p class="text-gray-600">通过 `Channel`，应用程序可以声明队列，包括设置队列的属性（如持久化、独占、自动删除）等。</p>
                            </div>
                            <div class="bg-white p-4 rounded-lg shadow-sm border border-gray-100">
                                <h4 class="font-bold mb-2 text-gray-800">队列绑定</h4>
                                <p class="text-gray-600">`Channel` 允许将队列与交换机进行绑定，并指定绑定键，从而定义消息的路由规则。</p>
                            </div>
                        </div>
                    </div>
                    
                    <div>
                        <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                            <i class="fas fa-random text-indigo-500 mr-2"></i>
                            交换机管理
                        </h3>
                        <div class="grid md:grid-cols-2 gap-6">
                            <div class="bg-white p-4 rounded-lg shadow-sm border border-gray-100">
                                <h4 class="font-bold mb-2 text-gray-800">交换机声明</h4>
                                <p class="text-gray-600">`Channel` 允许声明交换机，设置交换机的类型（如直接交换机、主题交换机、扇出交换机）及其属性（如持久化）。</p>
                            </div>
                            <div class="bg-white p-4 rounded-lg shadow-sm border border-gray-100">
                                <h4 class="font-bold mb-2 text-gray-800">交换机绑定</h4>
                                <p class="text-gray-600">`Channel` 允许将交换机与队列进行绑定，指定绑定键，从而实现消息的路由规则。</p>
                            </div>
                        </div>
                    </div>
                </section>

                <!-- Section 3 -->
                <section class="mb-12">
                    <h2 class="text-2xl md:text-3xl font-bold mb-6 text-gray-800 serif border-b pb-2">3. Channel 的特性</h2>
                    
                    <div class="grid md:grid-cols-3 gap-6 mb-8">
                        <div class="bg-white p-6 rounded-lg shadow-sm border border-gray-100 card-hover">
                            <div class="text-indigo-500 text-2xl mb-3">
                                <i class="fas fa-clipboard-check"></i>
                            </div>
                            <h3 class="text-lg font-semibold mb-2 text-gray-800">事务模式</h3>
                            <p class="text-gray-600 text-sm">`Channel` 支持事务模式，允许生产者在发布消息时使用事务来确保消息的可靠性。事务模式下的操作会有较高的延迟。</p>
                        </div>
                        
                        <div class="bg-white p-6 rounded-lg shadow-sm border border-gray-100 card-hover">
                            <div class="text-indigo-500 text-2xl mb-3">
                                <i class="fas fa-check-circle"></i>
                            </div>
                            <h3 class="text-lg font-semibold mb-2 text-gray-800">消息确认</h3>
                            <p class="text-gray-600 text-sm">`Channel` 支持手动消息确认（ACK）和拒绝（NACK）机制。消费者可以显式地确认或拒绝消息，确保消息的可靠处理。</p>
                        </div>
                        
                        <div class="bg-white p-6 rounded-lg shadow-sm border border-gray-100 card-hover">
                            <div class="text-indigo-500 text-2xl mb-3">
                                <i class="fas fa-bug"></i>
                            </div>
                            <h3 class="text-lg font-semibold mb-2 text-gray-800">错误处理</h3>
                            <p class="text-gray-600 text-sm">当 `Channel` 遇到不可恢复的错误时，它会关闭并抛出异常。应用程序可以捕获这些异常并采取恢复措施。</p>
                        </div>
                    </div>
                    
                    <!-- Feature Comparison Table -->
                    <div class="bg-white rounded-lg shadow-sm border border-gray-100 overflow-hidden">
                        <table class="min-w-full divide-y divide-gray-200">
                            <thead class="bg-gray-50">
                                <tr>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">特性</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">说明</th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">使用场景</th>
                                </tr>
                            </thead>
                            <tbody class="bg-white divide-y divide-gray-200">
                                <tr>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">事务</td>
                                    <td class="px-6 py-4 text-sm text-gray-500">确保一组操作的原子性</td>
                                    <td class="px-6 py-4 text-sm text-gray-500">对消息可靠性要求高的场景</td>
                                </tr>
                                <tr>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">确认机制</td>
                                    <td class="px-6 py-4 text-sm text-gray-500">手动确认消息处理状态</td>
                                    <td class="px-6 py-4 text-sm text-gray-500">避免消息丢失的关键业务</td>
                                </tr>
                                <tr>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">QoS</td>
                                    <td class="px-6 py-4 text-sm text-gray-500">控制未确认消息数量</td>
                                    <td class="px-6 py-4 text-sm text-gray-500">流量控制和负载均衡</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </section>

                <!-- Section 4 -->
                <section class="mb-12">
                    <h2 class="text-2xl md:text-3xl font-bold mb-6 text-gray-800 serif border-b pb-2">4. Channel 的使用</h2>
                    
                    <div class="mb-8">
                        <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                            <i class="fas fa-plus-circle text-indigo-500 mr-2"></i>
                            创建与关闭
                        </h3>
                        <div class="grid md:grid-cols-2 gap-6 mb-6">
                            <div>
                                <h4 class="font-bold mb-2 text-gray-800">创建</h4>
                                <p class="text-gray-600 mb-4">创建 `Channel` 需要通过已经建立的连接来创建。每个 `Channel` 都是独立的，可以同时进行多个操作。</p>
                            </div>
                            <div>
                                <h4 class="font-bold mb-2 text-gray-800">关闭</h4>
                                <p class="text-gray-600">使用完毕后，需要显式地关闭 `Channel`。关闭 `Channel` 是一种良好的资源管理实践，避免资源泄露。</p>
                            </div>
                        </div>
                        
                        <!-- Code Example -->
                        <div class="code-block p-4 rounded-lg mb-6">
                            <div class="flex items-center text-gray-400 text-sm mb-3">
                                <i class="fab fa-java mr-2"></i>
                                <span>Java 示例代码</span>
                            </div>
                            <pre class="text-sm overflow-x-auto"><code class="text-gray-200">// 创建连接
ConnectionFactory factory = new ConnectionFactory();
Connection connection = factory.newConnection();

// 创建 Channel
Channel channel = connection.createChannel();

// 声明队列
channel.queueDeclare("myQueue", true, false, false, null);

// 发布消息
channel.basicPublish("myExchange", "myRoutingKey", null, "Hello, World!".getBytes());

// 消费消息
channel.basicConsume("myQueue", true, (consumerTag, message) -> {
    System.out.println("Received: " + new String(message.getBody()));
}, consumerTag -> {});

// 关闭 Channel 和 Connection
channel.close();
connection.close();</code></pre>
                        </div>
                    </div>
                    
                    <!-- Best Practices -->
                    <div class="bg-indigo-50 p-6 rounded-lg border border-indigo-100">
                        <h3 class="text-xl font-semibold mb-4 text-indigo-800 flex items-center">
                            <i class="fas fa-star text-indigo-500 mr-2"></i>
                            Channel 使用最佳实践
                        </h3>
                        <ul class="list-disc pl-5 text-indigo-700 space-y-2">
                            <li>每个线程使用独立的 Channel，避免线程安全问题</li>
                            <li>合理设置 Channel 的 QoS (Quality of Service) 参数控制消息流</li>
                            <li>及时关闭不再使用的 Channel 释放资源</li>
                            <li>实现 Channel 的异常处理逻辑确保系统健壮性</li>
                            <li>在高并发场景下，适当增加 Channel 数量提高吞吐量</li>
                        </ul>
                    </div>
                </section>

                <!-- Section 5 -->
                <section class="mb-12" id="performance">
                    <h2 class="text-2xl md:text-3xl font-bold mb-6 text-gray-800 serif border-b pb-2">5. Channel 的性能考虑</h2>
                    
                    <div class="grid md:grid-cols-2 gap-8">
                        <div>
                            <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                                <i class="fas fa-tachometer-alt text-indigo-500 mr-2"></i>
                                高效利用
                            </h3>
                            <p class="text-gray-600 mb-4">使用多个 `Channel` 而不是多个连接可以提高系统的资源利用率和性能。每个 `Channel` 共享连接的资源，如 TCP 连接和会话信息。</p>
                            
                            <div class="bg-white p-4 rounded-lg shadow-sm border border-gray-100">
                                <div class="flex items-center mb-2">
                                    <i class="fas fa-info-circle text-indigo-500 mr-2"></i>
                                    <span class="font-medium">性能提示</span>
                                </div>
                                <p class="text-sm text-gray-600">在生产环境中，通常建议为每个工作线程创建一个 Channel，而不是为每个操作创建新 Channel。</p>
                            </div>
                        </div>
                        
                        <div>
                            <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                                <i class="fas fa-users text-indigo-500 mr-2"></i>
                                线程安全
                            </h3>
                            <p class="text-gray-600">`Channel` 不是线程安全的，不能在多个线程之间共享。每个线程应使用独立的 `Channel`。</p>
                            
                            <div class="mt-6">
                                <div class="flex items-center text-yellow-600 mb-2">
                                    <i class="fas fa-exclamation-triangle mr-2"></i>
                                    <span class="font-medium">警告</span>
                                </div>
                                <p class="text-sm text-gray-600">在多线程环境中共享同一个 Channel 会导致不可预知的行为。确保每个线程使用自己的 Channel 实例。</p>
                            </div>
                        </div>
                    </div>
                    
                    <!-- Performance Chart -->
                    <div class="mt-8 bg-white p-6 rounded-lg shadow-sm border border-gray-100">
                        <h3 class="text-lg font-semibold mb-4 text-gray-800 flex items-center">
                            <i class="fas fa-chart-line text-indigo-500 mr-2"></i>
                            Channel 数量与性能关系
                        </h3>
                        <div class="mermaid">
                            xychart-beta
                                title "Channel数量与吞吐量关系"
                                x-axis "Channel数量" [1, 5, 10, 20, 50]
                                y-axis "消息吞吐量(条/秒)" 0 --> 10000
                                line [3000, 6500, 8500, 9000, 9500]
                        </div>
                    </div>
                </section>

                <!-- Conclusion -->
                <section class="bg-white p-8 rounded-lg shadow-sm border border-gray-100 mt-12">
                    <div class="text-center">
                        <i class="fas fa-check-circle text-5xl text-green-500 mb-4"></i>
                        <h2 class="text-2xl font-bold mb-4 text-gray-800 serif">关键总结</h2>
                        <p class="text-gray-600 mb-6 max-w-2xl mx-auto">RabbitMQ 的 Channel 机制提供了一种高效、灵活的方式来处理消息操作。通过合理使用多个 Channel 而不是多个连接，可以显著提高系统性能和资源利用率。同时，理解 Channel 的事务、确认机制和线程安全特性对于构建可靠的消息系统至关重要。</p>
                        <div class="flex justify-center space-x-4">
                            <button class="px-6 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition flex items-center">
                                <i class="far fa-thumbs-up mr-2"></i> 点赞
                            </button>
                            <button class="px-6 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition flex items-center">
                                <i class="fas fa-share-alt mr-2"></i> 分享
                            </button>
                        </div>
                    </div>
                </section>
            </article>

            <!-- Sidebar -->
            <aside class="w-full lg:w-1/3">
                <!-- Author Card -->
                <div class="bg-white rounded-lg shadow-sm border border-gray-100 p-6 mb-6">
                    <div class="flex items-center mb-4">
                        <div class="w-16 h-16 rounded-full bg-indigo-100 flex items-center justify-center mr-4">
                            <i class="fas fa-user text-indigo-500 text-2xl"></i>
                        </div>
                        <div>
                            <h3 class="font-bold text-gray-800">RabbitMQ 专家</h3>
                            <p class="text-gray-500 text-sm">消息队列技术研究员</p>
                        </div>
                    </div>
                    <p class="text-gray-600 text-sm mb-4">专注于分布式消息系统和中间件技术研究，拥有多年 RabbitMQ 实战经验。</p>
                    <button class="w-full py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition flex items-center justify-center">
                        <i class="fas fa-user-plus mr-2"></i> 关注作者
                    </button>
                </div>
                
                <!-- Table of Contents -->
                <div class="bg-white rounded-lg shadow-sm border border-gray-100 p-6 mb-6 sticky top-6">
                    <h3 class="font-bold text-lg mb-4 text-gray-800 border-b pb-2 flex items-center">
                        <i class="fas fa-list-ul text-indigo-500 mr-2"></i>
                        文章目录
                    </h3>
                    <ul class="space-y-2">
                        <li><a href="#" class="text-gray-600 hover:text-indigo-600 transition flex items-center"><i class="fas fa-chevron-right text-xs mr-2 text-indigo-400"></i> Channel 的基本概念</a></li>
                        <li><a href="#" class="text-gray-600 hover:text-indigo-600 transition flex items-center"><i class="fas fa-chevron-right text-xs mr-2 text-indigo-400"></i> Channel 的作用</a></li>
                        <li><a href="#" class="text-gray-600 hover:text-indigo-600 transition flex items-center"><i class="fas fa-chevron-right text-xs mr-2 text-indigo-400"></i> Channel 的特性</a></li>
                        <li><a href="#" class="text-gray-600 hover:text-indigo-600 transition flex items-center"><i class="fas fa-chevron-right text-xs mr-2 text-indigo-400"></i> Channel 的使用</a></li>
                        <li><a href="#performance" class="text-gray-600 hover:text-indigo-600 transition flex items-center"><i class="fas fa-chevron-right text-xs mr-2 text-indigo-400"></i> Channel 的性能考虑</a></li>
                    </ul>
                </div>
                
                <!-- Related Articles -->
                <div class="bg-white rounded-lg shadow-sm border border-gray-100 p-6">
                    <h3 class="font-bold text-lg mb-4 text-gray-800 border-b pb-2 flex items-center">
                        <i class="fas fa-book-reader text-indigo-500 mr-2"></i>
                        相关文章
                    </h3>
                    <div class="space-y-4">
                        <a href="#" class="block group">
                            <div class="flex items-start">
                                <div class="flex-shrink-0 w-2 h-2 mt-2 bg-indigo-500 rounded-full mr-3"></div>
                                <div>
                                    <h4 class="text-gray-800 group-hover:text-indigo-600 transition font-medium">RabbitMQ 消息确认机制深入解析</h4>
                                    <p class="text-gray-500 text-sm">理解消息可靠传递的关键机制</p>
                                </div>
                            </div>
                        </a>
                        <a href="#" class="block group">
                            <div class="flex items-start">
                                <div class="flex-shrink-0 w-2 h-2 mt-2 bg-indigo-500 rounded-full mr-3"></div>
                                <div>
                                    <h4 class="text-gray-800 group-hover:text-indigo-600 transition font-medium">RabbitMQ 交换机类型与应用场景</h4>
                                    <p class="text-gray-500 text-sm">四种交换机类型的对比与实践</p>
                                </div>
                            </div>
                        </a>
                        <a href="#" class="block group">
                            <div class="flex items-start">
                                <div class="flex-shrink-0 w-2 h-2 mt-2 bg-indigo-500 rounded-full mr-3"></div>
                                <div>
                                    <h4 class="text-gray-800 group-hover:text-indigo-600 transition font-medium">RabbitMQ 集群配置指南</h4>
                                    <p class="text-gray-500 text-sm">构建高可用消息队列系统</p>
                                </div>
                            </div>
                        </a>
                    </div>
                </div>
            </aside>
        </div>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-12">
        <div class="container mx-auto px-6">
            <div class="flex flex-col items-center">
                <div class="text-xl font-bold text-white mb-4">
                    <i class="fas fa-code text-indigo-400 mr-2"></i>
                    <span class="serif">技术小馆</span>
                </div>
                <div class="mb-6 text-center">
                    <p class="mb-2">探索技术之美，分享开发智慧</p>
                    <a href="http://www.yuque.com/jtostring" class="text-indigo-400 hover:text-indigo-300 transition">http://www.yuque.com/jtostring</a>
                </div>
                <div class="flex space-x-6">
                    <a href="#" class="text-gray-400 hover:text-white transition text-xl">
                        <i class="fab fa-github"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-white transition text-xl">
                        <i class="fab fa-twitter"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-white transition text-xl">
                        <i class="fab fa-weixin"></i>
                    </a>
                </div>
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            fontFamily: 'Noto Sans SC, sans-serif'
        });
    </script>
</body>
</html>